﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_AddRoute : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            int originID = Convert.ToInt32(DropDownList1.SelectedValue);
            int destinationID = Convert.ToInt32(DropDownList2.SelectedValue);
            double flyHour = Convert.ToDouble(txtFlyHours.Text);

            AdminBAL _adminBAL = new AdminBAL();

            int routeID = _adminBAL.AddRoute(originID, destinationID, flyHour);
            Response.Redirect("~/Admin/AddSchedule.aspx?id=" + routeID);
        }
        catch (Exception)
        {
            lblWarn.Text = "Add Route failed";
        }

    }
}
